package com.ship.commens;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/*统一返回数据类型*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    /*响应码*/
    private Integer code = 200;
    /*提示信息*/
    private String msg;
    /*携带数据*/
    private Object data;
    /*总行数*/
    private Long total;
    /*后端代码报错、不成功*/
    public Result(Integer code,String msg){
        this.code=code;
        this.msg=msg;
    }

    public static Result SUCCESS=new Result(200,"访问成功");

    public static Result FAILURE=new Result(-1,"访问失败");

    /*前端参数格式错误*/
    public static final Result DATA_FORMAT_ERROR=new Result(-1,"前端参数格式错误");
}
